package com.mxw.commons.utils;

import com.mxw.commons.exception.CustomException;

/** @Description 自定义异常的工具类 @Author RingKo @Date 2022/10/10 10:52 @Version 1.0 */
public class CustomExceptionUtil {
  private CustomExceptionUtil() {}

  public static boolean whetherHideCustomErrorMessage(CustomException e) {
    // 非开发环境且非本地环境 && whetherDisplay定义为false时，屏蔽自定义异常抛出的信息，统一返回系统错误
    return Boolean.FALSE.equals(EnvironmentUtil.isDev())
        && Boolean.FALSE.equals(EnvironmentUtil.isLocal())
        && Boolean.FALSE.equals(e.getWhetherDisplay());
  }
}
